package com.controller.setting;

import com.comm.R;
import com.comm.vo.DrugTableVo;
import io.swagger.annotations.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@RequestMapping(value = "/systemDrug")
@Controller
@Api(value = "药品字典表",tags = "药品字典表接口")
@ApiResponses({
        @ApiResponse(code=200,message="请求成功"),
        @ApiResponse(code=404,message="找不到页面"),
        @ApiResponse(code=403,message="请求禁止"),
        @ApiResponse(code=401,message="请求未授权"),
        @ApiResponse(code=500,message="后台服务错误")})
public class SystemDrug {
    //1.4.1：查找所有的药品字典表
    @ResponseBody
    @RequestMapping(value ="/fundDrugs",method = RequestMethod.GET)
    @ApiOperation(value = "查找所有的药品字典表的接口",notes = "查找所有的药品字典表",httpMethod = "post", response = String.class)
    public  R fundDrugs(){
        R r = new R();
        r.setCode(200);
        r.setMsg("你好棒，查到了");
        String data = "[{\n" +
                "   \"id\": 100001,\n" +
                "   \"drugName\": \"伸腿瞪眼丸\",\n" +
                "   \"drugUsage\": \"内服\",\n" +
                "   \"drugRemark\": \"报吃\",\n" +
                "    \"durgSort\":\"中药\",\n" +
                "    \"durgSource\":\"走私\",\n" +
                "   \"drug _number\":1,\n" +
                "   \"drug_unit\":\"g\",\n" +
                "   \"drug_specification\":\"g\",\n" +
                "   \"drug_factory\":\"同仁堂\"\n" +
                "  },{\n" +
                "   \"id\": 100002,\n" +
                "   \"drugName\": \"伸腿瞪眼丸\",\n" +
                "   \"drugUsage\": \"内服\",\n" +
                "   \"drugRemark\": \"报吃\",\n" +
                "    \"durgSort\":\"中药\",\n" +
                "    \"durgSource\":\"走私\",\n" +
                "   \"drug _number\":1,\n" +
                "   \"drug_unit\":\"g\",\n" +
                "   \"drug_specification\":\"g\",\n" +
                "   \"drug_factory\":\"同仁堂\"\n" +
                "  },{\n" +
                "   \"id\": 100003,\n" +
                "   \"drugName\": \"伸腿瞪眼丸\",\n" +
                "   \"drugUsage\": \"内服\",\n" +
                "   \"drugRemark\": \"报吃\",\n" +
                "    \"durgSort\":\"中药\",\n" +
                "    \"durgSource\":\"走私\",\n" +
                "   \"drug _number\":1,\n" +
                "   \"drug_unit\":\"g\",\n" +
                "   \"drug_specification\":\"g\",\n" +
                "   \"drug_factory\":\"同仁堂\"\n" +
                "  }\n" +
                " ]";
        r.setData(data);
        return r;
    }
    //   1.4.2：添加药品字典表的接口：
    @ResponseBody
    @RequestMapping(value ="/addDrugs",method = RequestMethod.POST)
    @ApiOperation(value = "添加药品字典表的接口",notes = "添加药品字典表",httpMethod = "post", response = String.class)
    public  R addDrugs(@RequestBody @ApiParam(name = "实体类",value = "drugTable") DrugTableVo drugTable){
        R r = new R();
        r.setCode(200);
        r.setMsg("你好棒，添加成功");
        String data = "";
        r.setData(data);
        return r;
    }
    // 1.4.3：编辑药品字典表的接口：
    @ResponseBody
    @RequestMapping(value ="/editDrugs",method = RequestMethod.POST)
    @ApiOperation(value = "编辑药品字典表的接口",notes = "编辑药品字典表",httpMethod = "post", response = String.class)
    public  R editDrugs(@RequestBody @ApiParam(name = "实体类",value = "drugTable") DrugTableVo drugTable){
        R r = new R();
        r.setCode(200);
        r.setMsg("你好棒，编辑成功");
        String data = "";
        r.setData(data);
        return r;
    }
    // 1.4.4：删除药品字典表的接口：
    @ResponseBody
    @RequestMapping(value ="/deltDrugs",method = RequestMethod.POST)
    @ApiOperation(value = "删除药品字典表的接口",notes = "删除药品字典表",httpMethod = "post", response = String.class)
    @ApiImplicitParam(name = "id",value = "主键id",required = true,dataType = "int",paramType = "query")
    public  R delDrugs(@RequestParam(name = "id")Integer id){
        R r = new R();
        r.setCode(200);
        r.setMsg("你好棒，删除成功");
        String data ="";
        r.setData(data);
        return r;
    }
}
